package com.keepassex.inputmethod;

import android.inputmethodservice.InputMethodService;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

public class KeePassExKeyboard extends InputMethodService {
	private KeyboardView keyboardView;

	@Override
	public void onStartInputView(EditorInfo info, boolean restarting) {
		super.onStartInputView(info, restarting);
	}

	public void onInitializeInterface() {
		Log.d("DEBUG", "KeePassEx onInitializeInterface");
	}

	public View onCreateInputView() {
		keyboardView = new KeyboardView(this);
		return keyboardView;
	}

	int lastLen = 0;

	public void onKey(CharSequence text) {
		Log.d("DEBUG", "input onKey");
		InputConnection ic = getCurrentInputConnection();
		ic.setSelection(0, lastLen);
		ic.commitText(text, 0);
		lastLen = text.length();
	}
}
